﻿@page
@inherits Edu.Pages.EduPageBase


@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Edu.Permissions
@model Edu.Web.Pages.ImportData.IndexModel


@inject IAuthorizationService Authorization
@inject IPageLayout PageLayout
@{
    PageLayout.Content.Title = "任务管理";
    var lastImportResult = Edu.Web.Pages.ImportData.IndexModel.LastImportResult;
}


@if ( lastImportResult == Edu.Web.Pages.ImportData.ImportResult.Ok)
{
    <abp-alert alert-type="Success" dismissible="true">
        导入成功
    </abp-alert>
}
else if (lastImportResult == Edu.Web.Pages.ImportData.ImportResult.Error)
{
    <abp-alert alert-type="Danger" dismissible="true">
        导入失败 @Edu.Web.Pages.ImportData.IndexModel.ImportResultMessage
    </abp-alert>
}
<div id="StudyTasksWrapper">
    <abp-row class="mb-3">
        <abp-column size-md="_4">
            <abp-card class="shadow">
                <abp-card-body>
                    <abp-card-title>导入教师</abp-card-title>
                    <form method="post" asp-page="/ImportData/Index" enctype="multipart/form-data">
                        <abp-input type="file" asp-for="ImportData.File" label="上传文件" />
                        <abp-input type="hidden" asp-for="ImportData.Type" value="Teacher" label="上传文件" />
                        <button type="submit" class="btn btn-primary" data-busy-text="Processing..."><span>Submit</span></button>
                    </form>
                </abp-card-body>
            </abp-card>


        </abp-column>
        <abp-column size-md="_4">
            <abp-card class="shadow">
                <abp-card-body>
                    <abp-card-title>导入学生</abp-card-title>

                    <form method="post" asp-page="/ImportData/Index" enctype="multipart/form-data">
                        <abp-input type="file" asp-for="ImportData.File" label="上传文件" />
                        <abp-input type="hidden" asp-for="ImportData.Type" value="Student" label="上传文件" />
                        <button type="submit" class="btn btn-primary" data-busy-text="Processing..."><span>Submit</span></button>
                    </form>
                </abp-card-body>
            </abp-card>


        </abp-column>
        <abp-column size-md="_4">
            <abp-card class="shadow">
                <abp-card-body>
                    <abp-card-title>导入任务</abp-card-title>
                    <form method="post" asp-page="/ImportData/Index" enctype="multipart/form-data">
                        <abp-input type="file" asp-for="ImportData.File" label="上传文件" />
                        <abp-input type="hidden" asp-for="ImportData.Type" value="Task" label="上传文件" />
                        <button type="submit" class="btn btn-primary" data-busy-text="Processing..."><span>Submit</span></button>
                    </form>
                </abp-card-body>
            </abp-card>


        </abp-column>
    </abp-row>


</div>